package com.etc.controller;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value = "modelapi")
public class ModelController {

	@RequestMapping(value = "test1")
	public String test1(Model model) {
		// model.addAttribute(arg0)
		// 此处调用的是ExtendedModelMap对象的父类的ModelMap的方法
		model.addAttribute("key1", "value1");
		return "modelapi";
	}

	@RequestMapping(value = "test2")
	public String test2(ModelMap modelmap) {
		modelmap.addAttribute("key2", "value2");
		return "modelapi";
	}

	@RequestMapping(value = "test3")
	public String test3(Map map) {
		map.put("key3", "value3");
		return "modelapi";
	}

}
